package net.models;

// Generated 11 avr. 2013 10:40:17 by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * RapportsVisites generated by hbm2java
 */
@Entity
@Table(name = "rapports_visites", catalog = "bom")
public class RapportsVisites extends AbstractModel {

	private Integer				id;
	private Users				users;
	private Praticiens			praticiens;
	private Date				date;
	private String				bilan;
	private String				motif;
	private Set<Presentations>	presentationses	= new HashSet<Presentations>(0);
	private Set<Echantillons>	echantillonses	= new HashSet<Echantillons>(0);

	public RapportsVisites() {
	}

	public RapportsVisites(Users users, Praticiens praticiens, Date date, Date created, Date modified) {
		this.users = users;
		this.praticiens = praticiens;
		this.date = date;
	}

	public RapportsVisites(Integer id, Users users, String bilan, Praticiens praticiens) {
		this.id = id;
		this.users = users;
		this.bilan = bilan;
		this.praticiens = praticiens;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		Integer oldValue = this.id;
		this.id = id;
		firePropertyChange("id", oldValue, id);
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id", nullable = false)
	public Users getUsers() {
		return this.users;
	}

	public void setUsers(Users users) {
		Users oldValue = this.users;
		this.users = users;
		firePropertyChange("users", oldValue, users);
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "praticien_id", nullable = false)
	public Praticiens getPraticiens() {
		return this.praticiens;
	}

	public void setPraticiens(Praticiens praticiens) {
		Praticiens oldValue = this.praticiens;
		this.praticiens = praticiens;
		firePropertyChange("praticiens", oldValue, praticiens);
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "date", nullable = false, length = 10)
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		Date oldValue = this.date;
		this.date = date;
		firePropertyChange("date", oldValue, date);
	}

	@Column(name = "bilan")
	public String getBilan() {
		return this.bilan;
	}

	public void setBilan(String bilan) {
		String oldValue = this.bilan;
		this.bilan = bilan;
		firePropertyChange("bilan", oldValue, bilan);
	}

	@Column(name = "motif")
	public String getMotif() {
		return this.motif;
	}

	public void setMotif(String motif) {
		String oldValue = this.motif;
		this.motif = motif;
		firePropertyChange("motif", oldValue, motif);
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "rapportsVisites")
	public Set<Presentations> getPresentationses() {
		return this.presentationses;
	}

	public void setPresentationses(Set<Presentations> presentationses) {
		Set<Presentations> oldValue = this.presentationses;
		this.presentationses = presentationses;
		firePropertyChange("presentationses", oldValue, presentationses);
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "rapportsVisites")
	public Set<Echantillons> getEchantillonses() {
		return this.echantillonses;
	}

	public void setEchantillonses(Set<Echantillons> echantillonses) {
		Set<Echantillons> oldValue = this.echantillonses;
		this.echantillonses = echantillonses;
		firePropertyChange("echantillonses", oldValue, echantillonses);
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof RapportsVisites)
			return ((RapportsVisites) obj).getId().equals(id);
		return super.equals(obj);
	}
}
